﻿using System;
using DC2010.Objects.Data;
using DC2010.Objects.Logic;

namespace DC2010.Objects
{
    public class ItemLogic : BaseLogic
    {
        public ItemLogic(ItemData id)
        {
            Info = new ItemInfo();
            Gfx = Root.I.ItemSystem.GetGfx(id.GfxId);
            Data = id;
        }

        public ItemInfo Info { get; set; }
        public ItemGfx Gfx { get; set; }

        //events
        public event EventHandler OnEquip;
        public event EventHandler OnUnequip;

        //fireevents
        public void Equip()
        {
            if (OnEquip != null)
            {
                OnEquip(null, null);
            }
        }

        public void Unequip()
        {
            if (OnUnequip != null)
            {
                OnUnequip(null, null);
            }
        }

        public int GetObjectWeight()
        {
            //vaha predmetu
            // TODO: neni resen container...
            return (int)Info.Weight;
        }

        public void DecrementChargesRemaining()
        {
            ItemData id = (ItemData) Data;
            //id.Charges--;
        }
    }
}
